<template>
	<view>
		<uni-grid column="4" :showBorder="false" @change="change">
			<view v-for="(item,index) in lists">
				<uni-grid-item :index="index">

					<view class="box">
						<image :src="item.Icon" style="width: 40px;height: 40px; "></image>
						<view class="title" style="width: 40px;height: 20px; ">{{item.FullName}}</view>
					</view>
				</uni-grid-item>
			</view>
		</uni-grid>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				lists: [],

			}
		},
		onLoad(options) {

			/* if (!this.$store.state.hasLogin) {
				uni.redirectTo({
					url: '../login/login',
				})
			}
 */
			this.$api.Request({
				url: "/api/Index/GetListAppMenu",
				method: 'get',

			}).then((res) => {
				if (res) {
					this.lists = res;
				} else {
					uni.showToast({
						title: res.message,
						duration: 2000,
						icon: 'none',
					})
				}
			})
		},
		methods: {
			change(e) {
				console.log(this.$store.state.hasLogin);
				uni.navigateTo({
					url: this.lists[e.detail.index].Url
				})
				console.log(this.lists[e.detail.index].Url);
			},

		}
	}
</script>
<style>
	.title {
		font-size: 12rpx;
		color: #8f8f94;

	}

	.box {
		border-radius: 5px;
		padding: 10rpx;
		width: 60rpx;
		height: 60rpx;
	
		vertical-align: middle;
		text-align: center;
		
		margin: 0 auto;
	}
</style>
